package 继承.继承的应用场景;

public class Pig1 extends Animal{
    //构造方法
    public Pig1(){}
    public Pig1(String name,int age,String sex){
        this.name=name;
        this.age=age;
        this.sex=sex;
    }
    //公共方法
    public void snore(){
        System.out.println(name+"会打鼾");
    }
}
